public class TimeConvert
{
   /**
      Converts military time to ordinary time.
      @param milTime, the military time provided: hhmm
      @return a string of the form 9:35 am or 7 pm
   */
   public static String militaryToOrdinaryTime(int milTime)
   {
      String time="";
      if(milTime<100)
      {
         time+="12"+":"+milTime+" "+"am";
      }
      else if(milTime<1000)
      {
         if(milTime%100==0) 
            time+=(milTime/100)+" "+"am";
         else if(milTime%100<10)
            time+=(milTime/100)+":"+"0"+(milTime%100)+" "+"am";
         else time+=(milTime/100)+":"+(milTime%100)+" "+"am";
      }
      else
      {
         if(milTime%100==0) 
            time+=(milTime/100-12)+" "+"pm";
         else if(milTime%100<10)
            time+=(milTime/100-12)+":"+"0"+(milTime%100)+" "+"pm";
         else
            time+=(milTime/100-12)+":"+(milTime%100)+" "+"pm";
      }
      return time;
   }
}